package com.example.qiniutest.image.controller;

import com.example.qiniutest.image.service.impl.IFileService;
import com.example.qiniutest.image.vo.FileVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

@RestController
@RequestMapping("/image")
public class FileController {

    @Autowired
    IFileService fileService;

    @PostMapping("/upload")
    public FileVo upload(MultipartFile fileInput){
        return  fileService.upload(fileInput,false);
    }

    @PostMapping("/timestamp")
    public FileVo uploadTimeStampToPreventTheft(MultipartFile fileInput){
        return  fileService.upload(fileInput,true);
    }

}
